// Copyright (c) 2023, the Dart project authors.  Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'dart:async';

import 'package:macros/macros.dart';

import 'class_declarations_macro.dart';
import 'class_definition_macro.dart';
import 'class_types_macro.dart';

@ClassTypesDeclareTypeA()
@ClassDeclarationsDeclareInType('`int` get x => 3;')
@ClassDefinitionBuildField(
  name: 't',
  getter: '`int` get t => super.y;',
  setter: null,
  initializer: null,
  initializerComments: null,
)
class A {
  abstract final int t;
  int y = 0;

  void b() {}
}

@ClassDefinitionBuildConstructor(
  name: 'a',
  initializers: ['x = 3'],
  body: null, // TODO(davidmorgan): test body.
  comments: null, // TODO(davidmorgan): test comments.
)
class C {
  final int x;

  C.a();
}

String Function() a = () {
  return "";
};

void main() {
  ARepo();
  C.a();
  A().x;
  A().b();
}

typedef Cc = T Function<T>();

extension _Ext on Cc {
  T t<T>() {
    return this();
  }
}
